package com.mf.repository;

import com.mf.entity.Order;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

/**
 * Order接口
 *
 * @author: Jiang Runqing
 * @date: 2018-09-10 21:24
 */

public interface OrderRepository extends JpaRepository<Order, Integer>, JpaSpecificationExecutor<Order> {

    @Transactional
    @Query(value = "update t_order set order_status=?2 where order_id=?1", nativeQuery = true)
    @Modifying
    void updateStatus(int orderId, int orderStatus);
}
